from urllib.parse import *
from urllib.request import *

# result=urlparse("https://www.baidu.com/s?tn=90912598_hao_pg&ie=utf-8")
# print(result)
# print("协议：",result.scheme,result[0])
# print("主机和端口：",result.netloc,result[1])
# print("主机：",result.hostname)
# print("端口：",result.port)
# print("资源路径：",result.path,result[2])
# print("参数：",result.params,result[3])
# print("查询字符串：",result.query,result[4])
# print("fragment：",result.fragment,result[5])
#
# print(result.geturl())
# print(urlunparse(result))


with urlopen('https://www.hao123.com/?tn=90912598_hao_pg') as result:
    data=result.read(1000000)
    print(data.decode('utf-8'))